# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
LRdata = [[0.697, 0.460, 1],
        [0.774, 0.376, 1],
        [0.634, 0.264, 1],
        [0.608, 0.318, 1],
        [0.556, 0.215, 1],
        [0.403, 0.237, 1],
        [0.481, 0.149, 1],
        [0.437, 0.211, 1],
        [0.666, 0.091, 0],
        [0.243, 0.267, 0],
        [0.245, 0.057, 0],
        [0.343, 0.099, 0],
        [0.639, 0.161, 0],
        [0.657, 0.198, 0],
        [0.360, 0.370, 0],
        [0.593, 0.042, 0],
        [0.719, 0.103, 0]]  # 2 attributes(column),17 instances(row)
LRx=np.mat([i[:2] for i in LRdata])
LRy=(np.mat([i[2] for i in LRdata])).reshape(17,1)
LRI=np.ones(17).reshape(17,1)
LRx=np.column_stack((LRx,LRI))
omiga=np.linalg.inv(LRx.T*LRx)*LRx.T*LRy
print(omiga)
LRx=LRx.getA()
LRy=LRy.getA()
plt.scatter(LRx[:,0],LRx[:,1],LRy)
plt.show()